package io.renren.modules.udp.controller;

import java.util.Arrays;
import java.util.Map;

import io.renren.modules.udp.entity.R5rmOwnerEntity;
import io.renren.modules.udp.service.R5rmOwnerService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;



/**
 * 业主
 *
 * @author chenshun
 * @email sunlightcs@gmail.com
 * @date 2020-01-15 17:29:59
 */
@RestController
@RequestMapping("udp/r5rmowner")
public class R5rmOwnerController {
    @Autowired
    private R5rmOwnerService r5rmOwnerService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    @RequiresPermissions("udp:r5rmowner:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = r5rmOwnerService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{owId}")
    @RequiresPermissions("udp:r5rmowner:info")
    public R info(@PathVariable("owId") Integer owId){
		R5rmOwnerEntity r5rmOwner = r5rmOwnerService.selectById(owId);

        return R.ok().put("r5rmOwner", r5rmOwner);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("udp:r5rmowner:save")
    public R save(@RequestBody R5rmOwnerEntity r5rmOwner){
		r5rmOwnerService.insert(r5rmOwner);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("udp:r5rmowner:update")
    public R update(@RequestBody R5rmOwnerEntity r5rmOwner){
		r5rmOwnerService.updateById(r5rmOwner);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("udp:r5rmowner:delete")
    public R delete(@RequestBody Integer[] owIds){
		r5rmOwnerService.deleteBatchIds(Arrays.asList(owIds));

        return R.ok();
    }

}
